package com.css.fxfzysx.modules.vabStructure.controller;

import com.css.fxfzysx.base.response.RestResponse;
import com.css.fxfzysx.modules.cztDataMange.entity.HbpInfoEntity;
import com.css.fxfzysx.modules.vabStructure.param.ModelCalculationParam;
import com.css.fxfzysx.modules.vabStructure.service.FshBuildingsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 高层建筑破坏状态
 */
@RestController
@RequestMapping("fshBuildings")
public class FshBuildingsController {

    @Autowired
    private FshBuildingsService fshBuildingsService;

    /**
     * 高层建筑破坏状态信息分页查询
     */
    @GetMapping("queryFshBuildings")
    public RestResponse queryFshBuildings(HbpInfoEntity hbpInfoEntity, HttpServletRequest request) {
        return fshBuildingsService.queryFshBuildings(hbpInfoEntity, request);
    }

    /**
     * 根据id查询
     * @return
     */
    @GetMapping("queryFshBuildingsById")
    public RestResponse queryFshBuildingsById(String chbpiId) {
        return fshBuildingsService.queryFshBuildingsById(chbpiId);
    }

    /**
     * 计算
     */
    @PostMapping("modelCalculation")
    public RestResponse modelCalculation(@RequestBody ModelCalculationParam param) {
        return fshBuildingsService.modelCalculation(param);
    }

    /**
     * 导出
     */
    @GetMapping("importFshBuildings")
    public void importFshBuildings(String chbpiIds, HttpServletResponse response){
       fshBuildingsService.importFshBuildings(chbpiIds,response);
    }

    /**
     * 新增或修改
     * @param hbpInfoEntity
     * @return
     */
    @PostMapping("updateFshBuildings")
    public RestResponse updateFshBuildings(@RequestBody HbpInfoEntity hbpInfoEntity){
        return fshBuildingsService.updateFshBuildings(hbpInfoEntity);
    }
}
